#!/bin/bash
#description: compile the installation git on centos7.4
SOFTDIR="/opt/tools"
. /etc/rc.d/init.d/functions

[ ! -d $SOFTDIR ] && mkdir -p $SOFTDIR

#安装依赖
yum -y install curl-devel expat-devel gettext-devel openssl-devel unzip zlib-devel gcc gcc-c++ perl-ExtUtils-MakeMaker

#安装git2.7.4
cd $SOFTDIR 
[ ! -f v2.7.4.zip ] && wget https://github.com/git/git/archive/v2.7.4.zip
unzip v2.7.4.zip
cd git-2.7.4 && make prefix=/usr/local/git all && make prefix=/usr/local/git install
rm -rf /usr/bin/git
ln -s /usr/local/git/bin/git /usr/bin/git

#查看
if [ "`/usr/bin/git version |awk '{print $3}'`" == "2.7.4" ];then
	action "git install succfull" /bin/true
else
	action "git install fail" /bin/false
fi


